home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / comm / irc / KuangEleven3Gm.lha / Kuang Eleven 3 / Rexx / Reconnect.amirx < prev    next >
Text File  |  1998-05-09  |  4KB  |  163 lines

  1. /* $VER: Reconnect.amirx 1.4 (9.5.98) AmIRC Reconnect
  2.    Part of Kuang Eleven 2.9
  3.  
  4.   Introduction :
  5.  
  6.   AmIRC's internal reconnect is pretty lame in that if the
  7.   modem/stack drops it doesnt work.Could have easily been
  8.   fixed by using a retry value but I guess nobody's perect.
  9.   This script solves this problem.
  10.  
  11.  
  12.   Features     :
  13.  
  14.   · Configurable
  15.   · Fully automatic mode or fully configurable mode.
  16.   · Joins ALL previously joined channels
  17.   · Perfect if your away from the computer
  18.   · Has internal list of servers to connect to upon
  19.     disconnect or connects to last server.
  20.   · Sets you away , if you were away before with an
  21.     away message.Also iconifies the client if you
  22.     were away.
  23.  
  24.   Installation :
  25.  
  26.   1. Copy to the AmIRC rexx directory.
  27.   2. Enter into the Connect Event :
  28.      reconnect.amirx
  29.   3. Disable the internal AmIRC Auto Reconnect to server
  30.      from the "User modes" menu.
  31.   4. Set your timeout.This is the time a connect should last.
  32.   5. Set your retries.If your ISP is busy frequently then bump this
  33.      up.
  34.  
  35.   Advanced topics : using diffrent AmIRC configs
  36.  
  37.   If you are on an IRCnet with some servers that go down for
  38.   a while , set up the servers list.Note that reconect will then
  39.   connect to those servers only, distrupting your activity on
  40.   *other* IRCNets.
  41.   This can be solved by making a new AmIRC config for every network.
  42.   To do this :
  43.   1. Duplicate your reconnect.amirx script to something like :
  44.      UndernetReconnect.amirx
  45.   2. Edit the duplicate script and put a servers list there.
  46.   3. Follow the installation instructions BUT enter into
  47.      the connect event the duplicate's file name.
  48.   4. Turn on AmIRC's Settings/Create Icons Menu option.
  49.   5. Save Settings to a file of your choice.
  50.  
  51.   You may also edit the icon's tooltypes to autoconnect to
  52.   your preferred server with Server=.... and CONNECT
  53.   tooltypes.
  54.   Repeat the above steps for all the networks you're on and
  55.   put the icons on your favorite tools launcher.
  56.  
  57.   Well this really doesnt have much to do with reconnect.amirx
  58.   but it improves the usability of AmIRC and that is how I use
  59.   it.There is no way to make reconnect.amirx servers list work
  60.   on multiple networks otherwise.
  61.  
  62.   Programming techniques :
  63.  
  64.   Standard AmIRC AREXX to query information, GETLINE to process
  65.   server responses after connection and reset previous status.
  66.  
  67.   History      :
  68.  
  69.   1.0 12.2.97 First Release
  70.   1.1 Fixed bugs (JOIN)
  71.   1.2 Now checks if already connected (manual)
  72.   1.3 Now has an internal list of servers to cycle through.
  73.   1.4 Added support for away.
  74. *****  Config  *****
  75. */
  76.  
  77. /* Connect timeout in seconds
  78. */
  79. maxtimeout=60
  80.  
  81. /* number of retries
  82. */
  83. retries=5
  84.  
  85. /* Number of servers keep this to 0 to reconnect to the same server
  86.   (Value of 0 will cause to reconnect to previous server)
  87. */
  88. servers.0=0
  89.  
  90. /* List of servers to cycle through the number of servers must match
  91.    the servers.0 entry
  92. */
  93. servers.1='Honolulu.HI.US.GalaxyNet.org'
  94. servers.2='destiny.uk.galaxynet.org'
  95.  
  96. /* Away reason */
  97. awayreason='Not here'
  98.  
  99.  
  100.  
  101. /* Do not mess with code below */
  102. options results
  103. "GETSERVERNAME"
  104. server=result
  105. "CHANNELS"
  106. channels=strip(result)
  107. "GETAWAYSTATE"
  108. away=rc
  109. if servers.0~=0 then do
  110.     num=0
  111.     do i=1 to servers.0
  112.         if upper(servers.i)=upper(server) then num=i
  113.     end
  114.     num=num+1
  115.     if num>servers.0 then num=1
  116.     server=servers.num
  117. end
  118. cecho('AmIRC Reconnect 1.4 By Ariel Magnum.Reconnecting to' server 'channels' channels)
  119. do in=1 to retries
  120.     "ISCONNECTED"
  121.     if rc=0 then do
  122.         cecho('Already connected')
  123.         exit
  124.     end
  125.     'SAY /SERVER' server
  126.     do maxtimeout
  127.         "ISCONNECTED"
  128.         if rc=0 then leave
  129.         delay(50)
  130.     end
  131.     "ISCONNECTED"
  132.     if rc=5 then do
  133.         cecho('Attempt' in 'timed-out')
  134.         iterate
  135.     end
  136.     do until line.command='376'
  137.         "GETLINE"
  138.     end
  139.     if channels~='' then do
  140.         channels=translate(channels,',',' ')
  141.         'SAY /JOIN' channels
  142.         do words(channels)
  143.             do until line.command='JOIN'
  144.                 "GETLINE"
  145.             end
  146.         end
  147.     end
  148.  
  149.     if away=5 then do
  150.         /* check for Kuang Eleven - if present - Iconify */
  151.         x=getclip('st_init')
  152.         if x=2 then 'SAY /AWAY V HIDE' awayreason
  153.         else do
  154.             'SAY /AWAY' awayreason
  155.             "HIDE"
  156.         end
  157.     end
  158.     exit
  159. end
  160. cecho('Unable to reconnect')
  161. exit
  162. cecho:;"ECHO P="d2c(27)"b«Reconnect»" arg(1)'.';return 0
  163.